package com.crm.Servlet;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.crm.dao.BaseDictDao;
import com.crm.daoImpl.BaseDictDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;

/**
 * @version : 1.0
 * @auther : hjx
 * @Date : 2021/7/1
 * @Description : 实训
 */
public class queryAllIndustry extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html; charset=UTF-8");


        PrintWriter write = resp.getWriter();
        BaseDictDao baseDictDao = new BaseDictDaoImpl();
        String[] strings = baseDictDao.getBeseIndustry();
        req.setAttribute("s",strings);

        int[] count = baseDictDao.getIndustryCount();
        req.setAttribute("count",count);

        req.getRequestDispatcher("industry_list.jsp").forward(req,resp);
    }


}

